package api

import (
	"api-gateway/basic/config"
	__ "api-gateway/basic/proto"
	"api-gateway/handler/request"
	"api-gateway/handler/resp"
	"github.com/gin-gonic/gin"
)

func UpdatePrescript(c *gin.Context) {
	var req request.UpdatePrescriptReq
	if err := c.ShouldBind(&req); err != nil {
		resp.Error(c, 400, "参数有误", err.Error())
		return
	}

	updatePrescript, err := config.DoctorClient.UpdatePrescript(c, &__.UpdatePrescriptReq{
		PrescriptId: req.PrescriptId,
		Status:      req.Status,
	})
	if err != nil {
		resp.Error(c, 500, "服务端错误", err.Error())
		return
	}

	resp.Success(c, "处方审核成功", updatePrescript.PrescriptId)
}
